package com.ruoyi.project.erp.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.erp.domain.Worklog;
import com.ruoyi.project.erp.dto.MyWorklogQuery;
import com.ruoyi.project.erp.dto.SalesStatQuery;
import com.ruoyi.project.erp.dto.WorklogStatQuery;
import com.ruoyi.project.erp.mapper.AdminOaMapper;
import com.ruoyi.project.erp.service.IAdminOaService;
import com.ruoyi.project.erp.vo.*;
import com.ruoyi.project.system.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
public class AdminOaServiceImpl implements IAdminOaService {

    @Autowired
    private AdminOaMapper adminOaMapper;

    @Override
    public ProjectStatOverviewVo getProjectOverview(WorklogStatQuery query) {
        return adminOaMapper.getProjectOverview(query);
    }

    @Override
    public List<ProjectStatMemberVo> selectStatsByMemberList(WorklogStatQuery query) {
        return adminOaMapper.selectStatsByMemberList(query);
    }

    @Override
    public List<ProjectStatTaskVo> selectStatsByTaskList(WorklogStatQuery query) {
        return adminOaMapper.selectStatsByTaskList(query);
    }

    @Override
    public List<TaskDetialVO> selectWorklogDetailList(WorklogStatQuery query) {
        // 这里可以复用已有的工时查询逻辑
        return adminOaMapper.selectWorklogDetailList(query);
    }


    @Override
    public MyWorklogSummaryVo getMyWorklogSummary(MyWorklogQuery query) {
        return adminOaMapper.getMyWorklogSummary(query);
    }

    @Override
    // 同样修改这里的返回类型
    public List<TaskDetialVO> selectMyWorklogList(MyWorklogQuery query) {
        // 调用修改后的 Mapper 方法，它现在直接返回 List<TaskDetialVO>
        return adminOaMapper.selectMyWorklogList(query);
    }

    @Override
    public List<SalesStatSummaryVo> selectSalesSummaryStats(SalesStatQuery query) {
        return adminOaMapper.selectSalesSummaryStats(query);
    }
}
